#include "TCPServer.hpp"
#include <memory>

static void UserManual()
{
    std::cout << "please:./TCPServer ip port or /TCPServer port" << std::endl;
}

int main(int argc, char* argv[])
{
    std::string ip = "";
    uint16_t port;
    if (argc == 2)
    {
        port = atoi(argv[1]);
    }
    else if (argc == 3)
    {
        ip = argv[1];
        port = atoi(argv[2]);
    }
    else
    {
        UserManual();
        exit(-1);
    }

    std::unique_ptr<TCPServer> TCP_server(new TCPServer(port, ip));
    TCP_server->initTCPServer();
    TCP_server->start();
    return 0;
}